package com.woniu.elderly.serve.feignclient;

import com.woniu.common.dto.DealInsertOrderDTO;
import com.woniu.common.dto.DealOrderDTO;
import com.woniu.common.entity.DealOrder;
import com.woniu.common.entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "deal-order"/*, fallback = 降级方法实现类*/)
public interface DealOrderFeign {
    //分页+条件查询订单详情
    @PostMapping("/order/{pageIndex}/{pageSize}")
    Result getAllByConditionPage(
            @PathVariable("pageIndex") int pageIndex,
            @PathVariable("pageSize") int pageSize,
            @RequestBody DealOrderDTO dealOrderDTO
    );

    //新增订单
    @PostMapping("/order/")
    Result<String> addNewOrder(/*HttpServletResponse response,*/@RequestBody DealInsertOrderDTO dealInsertOrderDTO);


    //根据订单id查询订单
    @GetMapping("/order/{id}")
    Result<DealOrder> getDealOrderById(@PathVariable("id") int id);


    //调用支付接口
    @GetMapping("/alipay/{dealOrderNum}")
    String pay(@PathVariable("dealOrderNum") String dealOrderNum/*, HttpServletResponse response*/);

    @PutMapping("/order/")
    Result<Void> modify(@RequestBody DealOrder dealOrder);
}
